package com.rest.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


@RestController //@Controller @ResponseBody 二合一
@RequestMapping("/book")
public class BookController {
    @PostMapping
    public String save() {
        System.out.println("book saving...");
        return "{'module','book save'}";
    }

    @DeleteMapping("/{id}")
    public String delete(@PathVariable Integer id) {
        System.out.println("book delete" + id);
        return "{'module','book delete'}";
    }

    @PutMapping
    public String update() {
        System.out.println("book update");
        return "{'module','book delete'}";
    }

    @GetMapping("/{id}")
    public String getById(@PathVariable Integer id) {
        System.out.println("book getById" + id);
        return "{'module','book getById'}";
    }

    @GetMapping
    public String get(Integer id) {
        System.out.println("book get" + id);
        return "{'module','book get'}";
    }

}
